<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('选择生产单')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>批次号：</label>
                                <input type="text" name="batchNo"/>
                            </li>
                            <li>
                                <label>订单号：</label>
                                <input type="text" name="orderNo"/>
                            </li>
                            <li>
                                <label >销售订单编号：</label>
                                <input type="text" name="saleOrderNo"/>
                            </li>
                            <li>
                                <label>优先级：</label>
                                <select name="batchPriority" th:with="type=${@dict.getType('production_priority')}" required>
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var orderStatusDatas = [[${@dict.getType('production_status')}]];
        var priorityLevelDatas = [[${@dict.getType('production_priority')}]];
        var prefix = ctx + "order/productorder";

        $(function() {
            var options = {
                url: prefix + "/list",
                modalName: "排产单",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                columns: [{
                    radio: true
                },
                {
                    field: 'id',
                    title: '主键ID',
                    visible: false
                },
                {
                    field: 'batchNo',
                    title: '批次号'
                },
                {
                    field: 'orderNo',
                    title: '订单号'
                },
                {
                    field: 'orderDate',
                    title: '订单时间'
                },
                {
                    field: 'saleOrderNo',
                    title: '销售订单编号'
                },
                {
                    field: 'goodsName',
                    title: '生产商品'
                },
                {
                    field: 'goodsNum',
                    title: '生产数量'
                },
                {
                    field: 'goodsUnitDesc',
                    title: '商品单位'
                },
                {
                    field: 'inNum',
                    title: '入库数量'
                },
                {
                    field: 'status',
                    title: '审核状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(orderStatusDatas, value);
                    }
                },
                {
                    field: 'batchPriority',
                    title: '生产优先级',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(priorityLevelDatas, value);
                    }
                }
              ]
            };
            $.table.init(options);
        });


    </script>
</body>
</html>